package org.domain.acount.entity;

// Generated 02/11/2009 18:55:11 by Hibernate Tools 3.2.4.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.NotNull;

/**
 * Transacao generated by hbm2java
 */
@Entity
@Table(name = "transacao", catalog = "acount")
public class Transacao implements java.io.Serializable {

	private Integer idTransacao;
	private int contaIdConta;
	private String usuarioUsername;
	private Date data;
	private String historico;
	private BigDecimal valor;
	private Conta contaCredito;


	private Date datacriacao;
	
	public Transacao() {
	}

	public Transacao(int contaIdConta, String usuarioUsername, Date data,
			String historico, BigDecimal valor, Conta contaCredito,
			Date datacriacao) {
		this.contaIdConta = contaIdConta;
		this.usuarioUsername = usuarioUsername;
		this.data = data;
		this.historico = historico;
		this.valor = valor;
		this.contaCredito = contaCredito;
		this.datacriacao = datacriacao;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_transacao", unique = true, nullable = false)
	public Integer getIdTransacao() {
		return this.idTransacao;
	}

	public void setIdTransacao(Integer idTransacao) {
		this.idTransacao = idTransacao;
	}

	@Column(name = "conta_id_conta", nullable = false)
	public int getContaIdConta() {
		return this.contaIdConta;
	}

	public void setContaIdConta(int contaIdConta) {
		this.contaIdConta = contaIdConta;
	}

	@Column(name = "usuario_username", nullable = false)
	public String getUsuarioUsername() {
		return this.usuarioUsername;
	}

	public void setUsuarioUsername(String usuarioUsername) {
		this.usuarioUsername = usuarioUsername;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "data", nullable = false, length = 0)
	@NotNull
	public Date getData() {
		return this.data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	@Column(name = "historico", nullable = false)
	@NotNull
	public String getHistorico() {
		return this.historico;
	}

	public void setHistorico(String historico) {
		this.historico = historico;
	}

	@Column(name = "valor", nullable = false, precision = 10, scale=2, columnDefinition="decimal(10,2)")
	@NotNull
	public BigDecimal getValor() {
		return this.valor;
	}

	public void setValor(BigDecimal valor) {
		this.valor = valor;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "datacriacao", nullable = false, length = 0)
	@NotNull
	public Date getDatacriacao() {
		return this.datacriacao;
	}

	public void setDatacriacao(Date datacriacao) {
		this.datacriacao = datacriacao;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "conta_id_conta_credito", nullable = false)
	public Conta getContaCredito() { return contaCredito; }
	public void setContaCredito(Conta contaCredito) {
		this.contaCredito = contaCredito;
	}

}
